import pandas as pd

df1=pd.read_excel('result1_1.xlsx')
#从result1_1提取出所需数据
df2=df1.iloc[:,[0,9]]
#求出所要的总无机养百分比
df2['总无机养百分比']=df1['总氮百分比']+df1['P2O5百分比']+df1['K2O百分比']
#数据转换成三位小数
df2['总无机养百分比']=df2['总无机养百分比'].apply(lambda x:'%.3f'%x)

df2.to_excel('result1_2.xlsx',index=False)
